<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('学生项目管理')"/>
    <th:block th:include="include :: select2-css"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="data-form">
                <div class="select-list">
                    <ul>
                        <li>
                            <label style="width: 80px">测评类型：</label>
                            <select name="evaluateModuleType" th:with="type=${@dict.getType('business_project_module')}" class="form-control">
                                <option value="">全部</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}">
                                </option>
                            </select>
                        </li>
                        <li>
                            <label style="width: 80px">测评题目：</label>
                            <input type="text" name="evaluateQuestion"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a style="margin-left: 10px" class="btn btn-warning btn-rounded btn-sm" onclick="$.table.importExcel()"><i class ="fa fa-edit"></iclass></i>&nbsp;导入</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<script th:inline="javascript">
    // 权限
    var projectManageFlag = [[${@permission.hasPermi('education:trainingProgram:view')}]];
    // 字典
    var evaluateModuleType = [[${@dict.getType('business_project_module')}]];
    var prefix = ctx + "education/question";
    var importPrefix = ctx + "education/trainingProgram";

    $(function () {
        var options = {
            url: prefix + "/list",
            modalName: "数据",
            queryParams: queryParams,
            importUrl: importPrefix + "/importData",
            importTemplateUrl: importPrefix + "/importTemplate",
            columns: [
                {
                    field: 'projectModule',
                    title: '测评类型',
                    align: "center",
                    formatter: function (value, row, index) {
                        if ($.common.isNotEmpty(value)) {
                            return $.table.selectDictLabel(evaluateModuleType, value);
                        } else {
                            return null;
                        }
                    }
                },
                {
                    field: 'question',
                    title: '测评题目',
                    align: "center"
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="editProjectInformation(\'' + row.id + '\')"><i class="fa fa-check-square-o"></i>项目管理</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    function editProjectInformation(questionId) {
        var url = ctx + "education/trainingProgram/edit/" + questionId;
        $.modal.openTab("项目管理", url);
    }

    function queryParams(params) {
        var search = $.table.queryParams(params);
        return search;
    }

</script>
</body>
<script id="importTpl" type="text/template">
    <form enctype="multipart/form-data" class="mt20 mb10">
        <div class="col-xs-offset-1">
            <input type="file" id="file" name="file"/>
            <div class="mt10 pt5">
                <a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
            </div>
            <font color="red" class="pull-left mt10">
                提示：仅允许导入“xls”或“xlsx”格式文件，同一个文件测评类型需相同！
            </font>
        </div>
    </form>
</script>
</html>